package com.rfid.afd.activity.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.rfid.afd.activity.GatherActivity;
import com.rfid.db.bean.Rfid;
import com.rfid.rls_psw.R;

import java.util.List;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;

public class GatherAdapter extends RecyclerView.Adapter<GatherAdapter.MyViewHolder>{
    private Context mContext;
    private List<GatherActivity.Epc> mBarcodes;
    public GatherAdapter(Context context, List<GatherActivity.Epc>  data) {
        mContext = context;
        mBarcodes = data;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_gather,parent,false));
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
        holder.barcode.setText(mBarcodes.get(position).barcode);
    }

    @Override
    public int getItemCount() {
        return mBarcodes.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.barcode)
        TextView barcode;
        public MyViewHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }
}
